package top.hkyzf.study.leetcode.string;

import org.junit.Test;

/**
 * description:
 *
 * @author zhufeng
 * @version 1.0
 * @date 2024-4-1 21:17
 */
public class 故障键盘_2810 {
    public String finalString(String s) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            char ch = s.charAt(i);
            if (ch == 'i') {
                sb.reverse();
            } else {
                sb.append(ch);
            }
        }
        return sb.toString();
    }

    @Test
    public void testFinalString () {
        String s = "string";
        System.out.println(finalString(s));
    }
}
